<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="com.model.Serve" %>
<%@ page import="com.control.ServeControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
	request.setCharacterEncoding("UTF-8");
	String reply = request.getParameter("reply");
	int admin_id = (Integer)session.getAttribute("user_id");
	int fault_id = Integer.parseInt(request.getParameter("fault_id"));
	ServeControl sc = new ServeControl();
	boolean flag = Boolean.parseBoolean(request.getParameter("flag"));
	Serve serve = new Serve();
	serve.setAdmin_id(admin_id);
	serve.setFault_id(fault_id);
	serve.setServe_des(reply);
	if(flag == true) {
		if(sc.updateServe(serve)){
%>
			<script>
             	alert("修改成功！");
            	window.location.href("fault_show.jsp");
       		</script>
        <%}else {%>
        	<script>
				alert("修改失败！");
				window.location.href("fault_manage.jsp?id=<%=fault_id%>");
			</script>
	    <%}
	}
	else{
		if(sc.insertServe(serve)){
%>
			<script>
             	alert("插入成功!");
             	window.location.href("fault_show.jsp");
        	</script>
         <%}else{%>
	        <script>
	             alert("插入失败！");
	             window.location.href("fault_manage.jsp?id=<%=fault_id%>");
	        </script>
        <%}
	}
 %>
</body>
</html>